import { toFormData } from '@hdtd/utils';
import { useEffect } from 'react';
const ToFormData = () => {
  useEffect(() => {
    const data = {
      a: 'av',
      b: ['bv1', 'bv2'],
      c: {
        ca: 'cav',
        cb: 'cbv'
      },
      d: new Blob(),
      e: true,
      f: 10
    };

    const baseFormData = new FormData();
    baseFormData.append('test', '我是测试字段');

    const formData = toFormData(data, {
      hyphen: '_',
      keyPrefix: 'xixi',
      formData: baseFormData
    });
    formData.forEach((value, key) => {
      console.log(key, value);
    });
  }, []);
  return <div>ToFormData</div>;
};

export default ToFormData;
